﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SharingCenter.Web.Shared
{
    public partial class ProvinceCityDropDownList : System.Web.UI.UserControl
    {
        protected string selectedProvince;
        protected string selectedCity;

        public string SelectedProvince 
        {
            get { return ddlProvinces.SelectedValue; }
            set { selectedProvince = value; }
        }

        public string SelectedCity 
        {
            get { return ddlCities.SelectedValue; }
            set { selectedCity = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            //try
            //{
            //    cddProvinces.SelectedValue = selectedProvince;
            //    cddCities.SelectedValue = selectedCity;
            //    //ddlProvinces.Items.FindByValue(selectedProvince).Selected = true;
            //    //ddlCities.Items.FindByValue(selectedCity).Selected = true;
            //}
            //catch { }
        }

        protected void Page_PreRender(object sender, EventArgs e)
        {
            try
            {
                cddProvinces.SelectedValue = selectedProvince;
                cddCities.SelectedValue = selectedCity;
            }
            catch { }
        }
    }
}